#ifndef QCHOSSEIMAGE_H
#define QCHOSSEIMAGE_H

#include <QDialog>
#include <QTreeWidget>
#include <QPushButton>
#include <QList>
#include <QTreeWidgetItem>
#include <QComboBox>
#include <QLabel>
#include <QSpinBox>

class AbstractCore;

class ImageResourceDialog: public QDialog
{
    Q_OBJECT
public:
    ImageResourceDialog(AbstractCore *core,QWidget* parent=0);

    QString getSelect();
protected:
    void init();
protected slots:
    void itemDoubleClicked(QTreeWidgetItem* item,int index);
protected:
    QTreeWidget     *m_tree;
    AbstractCore    *m_core;
    QList<QTreeWidgetItem*> m_roots;
    QString         m_select;

};

class QChosseImage : public QDialog
{
    Q_OBJECT
public:
    QChosseImage(AbstractCore *core,QWidget* parent=0);

    int exec();

    void    init(const QString &name,const QRect &re,int type);

    QRect   getBorder();
    QString getResource();
    int     getType();
    void    setEnabledList(QStringList list);
protected slots:
    void    updateStyleSheet();

    void    showImage();
    void    typeChanged(int index);

    void    clicked();
    void    cancel();
    void    clear();
protected:
    QWidget     *m_imageWidget;
    QString     *m_image;
    QPushButton *m_imageButton;
    AbstractCore    *m_core;
    QString     m_select;
    QComboBox   *m_typeCombo;

    QLabel      *m_label[4];
    QSpinBox    *m_border[4];

    QPushButton *m_okBtn;
    QPushButton *m_cancleBtn;
    QPushButton *m_clearBtn;
    int         m_ret;
    QStringList  m_enabledList;
};

#endif // QCHOSSEIMAGE_H
